# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.676.12.3 -> 1.676.12.4 # arch/ia64/kernel/acpi.c 1.6 -> 1.7 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 02/09/27 t-kouchi@mvf.biglobe.ne.jp 1.676.12.4 # ia64: ACPI CRS cleanup. # -------------------------------------------- # diff -Nru a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c --- a/arch/ia64/kernel/acpi.c Wed Oct 8 09:10:01 2003 +++ b/arch/ia64/kernel/acpi.c Wed Oct 8 09:10:01 2003 @@ -112,33 +112,7 @@ #ifdef CONFIG_ACPI -/** - * acpi_get_crs - Return the current resource settings for a device - * obj: A handle for this device - * buf: A buffer to be populated by this call. - * - * Pass a valid handle, typically obtained by walking the namespace and a - * pointer to an allocated buffer, and this function will fill in the buffer - * with a list of acpi_resource structures. - */ -acpi_status -acpi_get_crs (acpi_handle obj, acpi_buffer *buf) -{ - acpi_status result; - buf->length = 0; - buf->pointer = NULL; - - result = acpi_get_current_resources(obj, buf); - if (result != AE_BUFFER_OVERFLOW) - return result; - buf->pointer = kmalloc(buf->length, GFP_KERNEL); - if (!buf->pointer) - return -ENOMEM; - - return acpi_get_current_resources(obj, buf); -} - -acpi_resource * +static acpi_resource * acpi_get_crs_next (acpi_buffer *buf, int *offset) { acpi_resource *res; @@ -146,12 +120,12 @@ if (*offset >= buf->length) return NULL; - res = buf->pointer + *offset; + res = (acpi_resource *)((char *) buf->pointer + *offset); *offset += res->length; return res; } -acpi_resource_data * +static acpi_resource_data * acpi_get_crs_type (acpi_buffer *buf, int *offset, int type) { for (;;) { @@ -163,12 +137,6 @@ } } -void -acpi_dispose_crs (acpi_buffer *buf) -{ - kfree(buf->pointer); -} - static void acpi_get_crs_addr (acpi_buffer *buf, int type, u64 *base, u64 *length, u64 *tra) { @@ -210,6 +178,9 @@ return; } break; + case ACPI_RSTYPE_END_TAG: + return; + break; } } } @@ -218,13 +189,14 @@ acpi_get_addr_space(acpi_handle obj, u8 type, u64 *base, u64 *length, u64 *tra) { acpi_status status; - acpi_buffer buf; + acpi_buffer buf = { .length = ACPI_ALLOCATE_BUFFER, + .pointer = NULL }; *base = 0; *length = 0; *tra = 0; - status = acpi_get_crs(obj, &buf); + status = acpi_get_current_resources(obj, &buf); if (ACPI_FAILURE(status)) { printk(KERN_ERR PREFIX "Unable to get _CRS data on object\n"); return status; @@ -232,7 +204,7 @@ acpi_get_crs_addr(&buf, type, base, length, tra); - acpi_dispose_crs(&buf); + acpi_os_free(buf.pointer); return AE_OK; } @@ -254,7 +226,8 @@ { int i, offset = 0; acpi_status status; - acpi_buffer buf; + acpi_buffer buf = { .length = ACPI_ALLOCATE_BUFFER, + .pointer = NULL }; acpi_resource_vendor *res; acpi_hp_vendor_long *hp_res; efi_guid_t vendor_guid; @@ -262,7 +235,7 @@ *csr_base = 0; *csr_length = 0; - status = acpi_get_crs(obj, &buf); + status = acpi_get_current_resources(obj, &buf); if (ACPI_FAILURE(status)) { printk(KERN_ERR PREFIX "Unable to get _CRS data on object\n"); return status; @@ -271,7 +244,7 @@ res = (acpi_resource_vendor *)acpi_get_crs_type(&buf, &offset, ACPI_RSTYPE_VENDOR); if (!res) { printk(KERN_ERR PREFIX "Failed to find config space for device\n"); - acpi_dispose_crs(&buf); + acpi_os_free(buf.pointer); return AE_NOT_FOUND; } @@ -279,14 +252,14 @@ if (res->length != HP_CCSR_LENGTH || hp_res->guid_id != HP_CCSR_TYPE) { printk(KERN_ERR PREFIX "Unknown Vendor data\n"); - acpi_dispose_crs(&buf); + acpi_os_free(buf.pointer); return AE_TYPE; /* Revisit error? */ } memcpy(&vendor_guid, hp_res->guid, sizeof(efi_guid_t)); if (efi_guidcmp(vendor_guid, HP_CCSR_GUID) != 0) { printk(KERN_ERR PREFIX "Vendor GUID does not match\n"); - acpi_dispose_crs(&buf); + acpi_os_free(buf.pointer); return AE_TYPE; /* Revisit error? */ } @@ -295,7 +268,7 @@ *csr_length |= ((u64)(hp_res->csr_length[i]) << (i * 8)); } - acpi_dispose_crs(&buf); + acpi_os_free(buf.pointer); return AE_OK; }